# ESB超时问题解决方案
# 1.场景介绍
使用ESB代理接口,ESB运行时经会出现各种超时问题,本文分类讲解ESB超时情况及解决方案。
适用于ESB8-9版本。
# 2.接口调用链介绍
将一个显示信息的Servlet注册成一个业务服务,并暴露成代理服务,供客户端调用。
接口调用链流程图如下:
# 3.超时分类及对应解决方案
# 3.1 Transport请求等待超时
transport的请求等待时间(默认200000ms):
1)耗时涉及步骤:2->3->4->5->6->7->8->9->10->11
2)超时后返回报文:Request Time out 200000ms
3)超时告警后,调整超时时间:
在线:
在{server安装目录}/server/plugins/com.primeton.esb.service.online-x.x-LA.jar/META-INF/template/transport_http_conn.vm中新增配置<timeout>600000</timeout>,超时时间根据业务实际超时情况修改。如下图:
离线: 在/server/EOS/_srv/work/user/com.primeton.esb.xxx.common/com/primeton/esb/xxx/common/transport/transport_http/transport_http.transport_http_conn文件中timeout,增加配置<timeout>500000</timeout>
# 3.2 Endpoint响应超时
# 3.2.1 原服务无响应
1)耗时涉及步骤:5->6->7->8,超时步骤:6->7->8
2)超时后返回报文:
java.util.concurrent.TimeoutException: No response received after 180000
3)超时告警后,调整超时时间:
在线:
修改{server安装目录}/server/EOS/_srv/work/system/com.primeton.esb.online.common/com
/primeton/esb/online/common/endpoint/endpoint_http/ endpoint_http.endpoint_http_conn中的<timeOut>
离线:
governor->服务配置->endpoint_http连接池配置-超时时间
# 3.2.2 源服务有响应,但是报文较大,未传输完endpoint超时
1)耗时涉及步骤:5->6->7->8,超时步骤:7->8
2)超时后返回报文:
java.util.concurrent.TimeoutException: Read timeout to /IP:PORT of 60000 ms
3)超时告警后,调整超时时间:
如下版本需要申请并打上补丁:
ESB8.0: ESB_8.0.0_SERVER_20220913_C1
ESB8.5:ESB_8.5.0GA_SERVER_20230112_C1
ESB8.6: ESB_8.6.0_SERVER_20230808_P1
在线: 在/server/EOS/_srv/work/system/com.primeton.esb.online.common/com/primeton/esb/online/common/endpoint/endpoint_http/endpoint_http.endpoint_http_conn文件新增配置<readTimeOut>20000</readTimeOut>
离线: 在/server/EOS/_srv/work/user/com.primeton.esb.XXX.common/com/primeton/esb/gaoce_demo/common/endpoint/XXX/xxx.endpoint_http_conn文件新增配置<readTimeOut>20000</readTimeOut>
# 3.3 Endpoint连接超时
1)耗时涉及步骤:5->6
2)超时后返回报文:
java.net.ConnectException: Connection refused: /IP:PORT
3)超时告警后,调整超时时间: 在线:
修改/server/EOS/_srv/work/system/com.primeton.esb.online.common/com/primeton/esb/online/common/endpoint/endpoint_http/endpoint_http.endpoint_http_conn文件<connectionTimeOut>30000</connectionTimeOut>参数值
离线:
governor->服务配置->endpoint_http连接池配置-连接超时时间
# 3.4 超时拦截器
1)耗时涉及步骤:2->3->4->5->6->7->8->9->10->11;
2)触发超时后返回报文:该请求超过服务超时限制
3)触发逻辑: 调用之前会记录一个时间,响应回来后,会记录一个时间,这两个时间差和配置的时间(governor配置的时间单位是秒,不是毫秒)做对比,如果超过配置的时间,会返回超时,但是如果调用源服务异常后,是不触发超时拦截器的, 只有正常返回的时候触发。
4)超时告警后,调整超时时间: